<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .row {
            display: flex;
            align-items: center;
        }

        .icon {
            width: 50px;
            height: 50px;
            object-fit: cover;
        }
    </style>
</head>

<body>
    <h1>抽奖h5后台管理</h1>
    <form action="/index/choujiang" method="post" style="margin-left: 10px;">
        <input type="submit" value="测试抽奖">
    </form>
    <hr>

    <h4>中奖记录</h4>
    <table>
        <tr>
            <th>姓名</th>
            <th>年龄</th>
            <th>性别</th>
            <th>奖项</th>
        </tr>
        <tr>
            <td></td>
        </tr>
    </table>
    <hr>

    <h4>当前奖品</h4>
    <table>
        <tr>
            <th>id</th>
            <th>奖品名称</th>
            <th>奖品图</th>
            <th>奖品概率</th>
            <th>数量</th>
            <th>操作</th>
        </tr>
        {volist name="list" id="vo"}
        <tr>
            <td>{$vo.id}</td>
            <td>{$vo.name}</td>
            <td><img src="{$vo.icon}" class="icon"></td>
            <td>{$vo.odds}%</td>
            <td>{$vo.count}</td>
            <td class="row">
                <form action="/index/updprize" method="post">
                    <input type="hidden" name="id" value="{$vo.id}">
                    <input type="number" name="odds" placeholder="奖品概率" style="width:70px;">
                    <input type="text" name="name" placeholder="奖品名称" style="width:70px;">
                    <input type="text" name="count" placeholder="奖品数量" style="width:70px;">
                    <input type="file" name="image" />
                    <input type="submit" value="修改">
                </form>
                <form action="/index/delprize" method="post" style="margin-left: 10px;">
                    <input type="hidden" name="id" value="{$vo.id}">
                    <input type="submit" value="删除">
                </form>
            </td>
        </tr>
        {/volist}
    </table>
    <hr>

    <h4>添加奖品</h4>
    <form action="/index/addprize" method="post" enctype="multipart/form-data">
        <div>
            <span>奖品概率</span>
            <input type="number" name="odds">
            <span>%</span>
        </div>
        <div>
            <span>奖品名称</span>
            <input type="text" name="name">
        </div>
        <div>
            <span>奖品数量</span>
            <input type="number" name="count">
        </div>
        <div>
            <span>奖品icon</span>
            <input type="file" name="image" />
        </div>
        <br>
        <input type="submit" value="提交">
    </form>
    <hr>

    <h4>当前中奖条件</h4>
    <form action="/index/setman" method="post">
        <span>男生中奖几率：{$sex_odds.man}%</span>
        <input type="number" name="odds" placeholder="男生几率" style="width:70px;">
        <input type="submit" value="修改">
    </form>
    <form action="/index/setwoman" method="post">
        <span>女生中奖几率：{$sex_odds.woman}%</span>
        <input type="number" name="odds" placeholder="女生几率" style="width:70px;">
        <input type="submit" value="修改">
    </form>
    <br>
    <table>
        <tr>
            <th>年龄最大值</th>
            <th>年龄最小值</th>
            <th>年龄几率</th>
            <th>操作</th>
        </tr>
        {volist name="age_odds" id="vo"}
        <tr>
            <td>{$vo.max}</td>
            <td>{$vo.min}</td>
            <td>{$vo.odds}%</td>
            <td class="row">
                <form action="/index/updAge" method="post">
                    <input type="hidden" name="id" value="{$vo.id}">
                    <input type="number" name="max" placeholder="年龄最大值" style="width:70px;">
                    <input type="number" name="min" placeholder="年龄最小值" style="width:70px;">
                    <input type="number" name="odds" placeholder="年龄几率" style="width:70px;">
                    <input type="submit" value="修改">
                </form>
                <form action="/index/delAge" method="post" style="margin-left: 10px;">
                    <input type="hidden" name="id" value="{$vo.id}">
                    <input type="submit" value="删除">
                </form>
            </td>
        </tr>
        {/volist}
    </table>
    <br>

    <form action="/index/setAge" method="post">
        <input type="number" name="max" placeholder="年龄最大值" style="width:70px;">
        <input type="number" name="min" placeholder="年龄最小值" style="width:70px;">
        <input type="number" name="odds" placeholder="年龄几率" style="width:70px;">
        <input type="submit" value="新增">
    </form>
    <hr>
</body>

</html>